<?php
/**
 * User: yyw
 * Date: 2017/6/26
 * Time: 16:59
 * Progress:0%
 */

namespace app\shop\controller;


use icontroller\admin\AController;
use icontroller\admin\shop\IShopOrder;
use logic\admin\shop\LShopOrder;

class ShopOrder extends AController implements IShopOrder
{

    private $logic;
    function __construct()
    {
        parent::__construct();
        $this->logic = new LShopOrder();
    }

    public function index()
    {
        $cal = $this->logic->logic_index();
        $this->assign('cal', $cal);
        return view();
    }
    public function delivery_pay()
    {
        return view();
    }
    public function delivery_summary()
    {
        return view();
    }

    public function index_data()
    {
        $param=array(
            'search'=>input('search'),
            'limit'=>input('limit'),
            'offset'=>input('offset'),
            'sort'=>input('sort'),
            'order'=>input('order'),
            'status'=>input('status'),
            'flag_status'=>input('flag_status'),
            'flag_delivery'=>input('flag_delivery'),
            'begindate'=>input('begindate'),
            'enddate'=>input('enddate'),
            'online_pay'=>input('online_pay'),
        );
        $data=$this->logic->index_data($param);
        return $data;
    }

    public function delivery_data()
    {
        $param=array(
            'search'=>input('search'),
            'limit'=>input('limit'),
            'offset'=>input('offset'),
            'sort'=>input('sort'),
            'order'=>input('order'),
            'flag_status'=>input('flag_status'),
            'flag_delivery'=>input('flag_delivery'),
            'order_time'=>input('order_time'),
            'da_id'=>input('da_id')
        );
        $data=$this->logic->delivery_data($param);
        return $data;
    }

    public function summary_data()
    {
        $param=array(
            'search'=>input('search'),
            'limit'=>input('limit'),
            'offset'=>input('offset'),
            'sort'=>input('sort'),
            'order'=>input('order'),
            'status'=>input('status'),
            'flag_status'=>input('flag_status'),
            'flag_delivery'=>input('flag_delivery'),
            'begindate'=>input('begindate'),
            'enddate'=>input('enddate'),
            'online_pay'=>input('online_pay'),
        );
        $data=$this->logic->summary_data($param);
        return $data;
    }

    public function edit()
    {

    }

    public function detail()
    {
        $id=input('id');
        $data=$this->logic->detail_store_item($id);
        $order_data = $this->logic->order_data($id);
        $this->assign('data',$data);
        $this->assign('order_data',$order_data);
        return view();
    }

    public function change_status()
    {

    }

    //批量处理预算
    public function set_flag_delivery_pay()
    {
        $ids=input('ids');
        $type=input('type');
        return $this->logic->set_flag_delivery_pay($type,$ids);
    }
}